cmake_minimum_required(VERSION 3.5)

set(target_name "ut-core")

set(TEST_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../core.c
                ${CMAKE_CURRENT_LIST_DIR}/../../comp1/comp1_main.c
                ${CMAKE_CURRENT_LIST_DIR}/test_main.c
                ${CMAKE_CURRENT_LIST_DIR}/test_core.c)

string(REGEX REPLACE "-m32" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})

SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})

add_executable( "${target_name}" ${TEST_SOURCES})
target_link_libraries( "${target_name}" "cmocka" "3rd" "gcov")
target_compile_options("${target_name}" PRIVATE -DUNITTEST "--coverage" )
